my_list = [1, 2, 3, "str111", "asdasd", "qwdsa3d165", 1, 2, 3, "asdqw", "小天才", "QA"]
# 1.
# list_t = [item for item in my_list if not isinstance(item, str)]
# print(list_t)
# 2.
# new_list = list(set(my_list))
# print(new_list)
# 3.1
# l1 = [1, 2, 3, 4, 5]
# index = l1.index(3) + 1  # 备注：获取元素 3 的索引，并在其后面插入
# l1.insert(index, 300)
# print(l1)
#3.2
# l1.remove(2)
# #remove删除单项元素，多项重复元素应用循环遍历来删除
# print(l1)
#3.3
# index = l1.index(5)  # 获取元素 5 的索引并进行赋值
# l1[index] = 500
# print(l1)
#3.4
# old_list = l1[1:4]
# print(old_list)
#3.5
#3.6
#2.
# names = ["xi", "eric", "alvin", "george"]
# name = input("请输入一个姓名：")
# # 判断姓名是否存在于列表中
# if name in names:
#     print("该姓名存在于列表中。")
# else:
#     print("该姓名不存在于列表中。")
# 4
# l = [1, 2, 3, [4, 5]]
# l[3][0] = 400
# # 第三位为【4,5】，0为嵌套列表中第一位4
# print(l)
# # 4.2
# l[3].append(6)
# # 追加为.append
# print(l)
# 5
# fooo = {
#     "苹果": 32.8,
#     "香蕉": 22,
#     "葡萄": 15.5
# }
# # 如果想查询对应金额
# print(fooo["苹果"])
# 6.
# dic = {
#     'python': 95,
#     'java': 99,
#     'c': 100
# }
# dic['java'] = 98
# #直接赋值输出就行
# print(dic)
# 6.2
# del dic['c']
# # del命令直接删除就行
# print(dic)
# 6.3
# dic['php'] = 90
# # 同上直接赋值
# print(dic)
# 6.4
# list3 = list(dic.keys())
# # list为强制转换列表类型
# print(list3)

# 6.5
# if 'javascript' in dic:
#     print("存在在字典")
# else:
#     print("不存在在字典")

# 6.6
# summ = sum(dic.values())
# # dic.values()是为了获取values值
# print(summ)

# 6.7
# 6.8
# 6.9
# dic1 = {
#     'php': 97
# }
#
# dic.update(dic1)
#
# print(dic)

# list1 = [12, 45, 78, 12, 45, 78, 12, 77, 99, 53, 6, 93]
# new_dict = {}
# for item in list1:
#     new_dict[item] = new_dict.get(item, 0) + 1
#
# print(new_dict)

# 7.2




